1. Field of the Invention
The present invention relates to a technique for detecting an area including a specific object from an image, and encoding the image based on the detection result.
2. Description of the Related Art
In order to transmit, store, and reproduce a moving image, an image signal encoding technique is used. As a moving image encoding technique, an international standard coding method such as ISO/IEC International Standard 13818 (MPEG-2) is known. As another international standard coding method, ISO/IEC International Standard 14496-2 (MPEG-4 Visual) is known. Also, ITU-T Rec. H.264 Advanced Video Coding|ISO/IEC International Standard 14496-10 (MPEG-4 AVC/H.264; to be referred to as H.264 hereinafter) is known. These techniques are used in the fields of digital cameras, video cameras, recorders, and the like.
On the other hand, in recent years, processing for specifying an area including a specific object such as a human face (to be referred to as a specific area hereinafter), which seems to be important, from an image, and changing encoding parameters such as quantization values for the specific area and the remaining area is executed. With this processing, image quality is improved for the specific area, and a code amount is suppressed for the remaining area, thereby improving the image quality of the area including the object which seems to be important, while maintaining an allowable bit rate for a recording medium or communication path.
In order to implement the aforementioned processing, processing for detecting a specific area has to be executed for all frames included in input moving image data. However, it is difficult to execute the processing for detecting a specific area with high accuracy (to be referred to as “specific area detection processing” hereinafter) at the same frame rate as that of encoding.
To solve such problem, a related art which predicts a specific area using motion vectors detected at the encoding timing (to be referred to as “specific area prediction processing” hereinafter) is disclosed (patent literature 1 (Japanese Patent Laid-Open No. 2007-336259)). In patent literature 1, when a motion vector of a block in a frame for which the specific area detection processing is skipped indicates a specific area in a frame which has undergone the specific area detection processing, that block is predicted as the specific area.
In general, in motion vector detection processing, a location where a difference of pixel values between blocks is minimized is detected as a motion vector. Therefore, even when a specific area prediction target block includes an area which seems to be important, since a motion vector of that block does not always indicate a specific area of a frame which has undergone the specific area detection processing, that block is often not predicated as the specific area.
Since a code amount is suppressed by increasing quantization values for an area other than the specific area, if the prediction accuracy of the specific area is low, image quality of an area, which is to be originally predicted as a specific area, may drop. When a location which falls short of specific area prediction is referred to in inter-frame predictive coding processing, quantization errors propagate, thus also dropping the image qualities of subsequent frames.